<script>
import {defineComponent} from 'vue'
import actApi from "@/utils/api/actApi";
import LoadList from "@/components/LoadList.vue";
import UserAvatarName from "@/components/UserAvatarName.vue";

export default defineComponent({
  name: "ApplyUser",
  components: {UserAvatarName, LoadList},
  setup(){
    return {
      listApplyUser: actApi.listApply
    }
  },
  created() {
    let actId = this.$route.query.actId
    this.params[0] = Number(actId)
  },
  data(){
    return {
      params: []
    }
  },
  methods: {
    gotoApplyDetail(applyId){
      this.$router.push({
        path: '/act/apply/info',
        query: {
          actId: this.params[0],
          applyId: applyId
        }
      })
    }
  }
})
</script>

<template>
  <div class="apply-user-container-div">
    <div class="apply-user-head-div">
      报名人员列表
    </div>
    <LoadList
        ref="applyUserList"
        :load-func="listApplyUser"
        :params="params"
    >
      <template v-slot:list="{list}">
        <div v-for="(item, index) in list">
          <div class="apply-user-item-div">
            <div class="apply-user-item-left-div">
              <UserAvatarName
                  :user="item.user"
              />
            </div>
            <div class="apply-user-item-right-div">
              <span v-show="item.sign">
                <van-tag type="success">已签到</van-tag>
              </span>
              <span>
                <el-button type="primary" plain round size="small" @click="gotoApplyDetail(item.applyId)">详情</el-button>
              </span>
            </div>
          </div>
          
        </div>
      </template>
    </LoadList>
  </div>
  
</template>

<style scoped lang="less">
@import "@/assets/style/less/all.less";

.apply-user-container-div {
  display: flex;
  flex-direction: column;
  margin: 5px 10px;
  >.apply-user-head-div{
    text-align: center;
    margin: 5px 10px;
    font-size: 20px;
  }
}

.apply-user-item-div {
  display: flex;
  flex-direction: row;
  align-items: center;
  background-color: white;
  border: 1px solid @user_index_cell_group_border_color;
  border-radius: 5px;
  margin-bottom: 3px;
  >.apply-user-item-left-div{
    .flex-item-fit-width();
  }
  >.apply-user-item-right-div{
    .flex-item-fix();
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-right: 3px;
  }
}
</style>